
const fs = require('fs');


module.exports = (function() {
    let fileList = [];

    fileList = fs.readdirSync('./src/views', 'utf-8');
    //development  production
    if (process.env.NODE_ENV === 'production') {
        const result = {};
        Array.isArray(fileList) && fileList.forEach(v => {
            result[v] = `src/views/${ v }/main.js`;
        });
        return result;
    } else {
        const result = {};
        Array.isArray(fileList) && fileList.forEach(v => {
            result[v] = `src/views/${ v }/main.js`;
            // result[v] = {
            //     entry: `src/views/${ v }/main.js`,
            //     template: 'public/index.html',
            //     chunks: [ 'chunk-vendors', 'chunk-common', v ]
            // }
        });
        return result;
        // return {
        //     outputPath: 'dist',
        //     pages: result
        // };
    }
})();
